home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / usr / sybase / doc / dbcoltype.man < prev    next >
Text File  |  1993-04-22  |  3KB  |  111 lines

  1.  
  2.   1                       Version 4.0 -- 5/1/89                dbcoltype
  3.   ______________________________________________________________________
  4.  
  5.   NAME:  dbcoltype
  6.  
  7.   FUNCTION:
  8.        Return the datatype for a regular result column.
  9.  
  10.   SYNTAX:
  11.        int dbcoltype(dbproc, column)
  12.  
  13.        DBPROCESS *dbproc;
  14.        int       column;
  15.  
  16.   COMMENTS:
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.   dbcoltype               Version 4.0 -- 5/1/89                        2
  25.   ______________________________________________________________________
  26.  
  27.        o This routine returns the datatype for  a  regular  (i.e.,  non-
  28.          compute)  result  column.   For a list of SQL Server datatypes,
  29.          see the manual page for types.
  30.        o dbcoltype() actually returns an integer  token  value  for  the
  31.          datatype  (SYBCHAR, SYBFLT8, etc.).  To convert the token value
  32.          into  a  readable  token  string,  use  dbprtype().   See   the
  33.          dbprtype() manual page for a list of all token values and their
  34.          equivalent token strings.
  35.  
  36.        o You can use dbvarylen() to determine whether a  column's  data-
  37.          type is variable length.
  38.        o Here's a program fragment that uses dbcoltype():
  39.  
  40.          DBPROCESS       *dbproc;
  41.          int             colnum;
  42.          int             coltype;
  43.  
  44.  
  45.  
  46.   3                       Version 4.0 -- 5/1/89                dbcoltype
  47.   ______________________________________________________________________
  48.  
  49.          /* put the command into the command buffer */
  50.          dbcmd(dbproc, "select name, id, type from sysobjects");
  51.  
  52.          /* send the command to SQL Server and begin execution */
  53.          dbsqlexec(dbproc);
  54.  
  55.          /* process the command results */
  56.          dbresults(dbproc);
  57.  
  58.          /* examine the column types */
  59.          for (colnum = 1; colnum < 4; colnum++)
  60.          {
  61.              coltype = dbcoltype(dbproc, colnum);
  62.              printf("column %d, type is %s.\n", colnum,
  63.                  dbprtype(coltype));
  64.          }
  65.  
  66.  
  67.  
  68.   dbcoltype               Version 4.0 -- 5/1/89                        4
  69.   ______________________________________________________________________
  70.  
  71.  
  72.   PARAMETERS:
  73.        dbproc -  A pointer to the DBPROCESS structure that provides  the
  74.            connection for a particular front-end/SQL Server process.  It
  75.            contains all the information that DB-Library uses  to  manage
  76.            communications and data between the front end and SQL Server.
  77.        column -  The number of the column of interest.  The first column
  78.            is number 1.
  79.  
  80.   RETURNS:
  81.        A token value for the datatype for a particular column.
  82.  
  83.        In a few cases, the token value returned by this routine may  not
  84.        correspond exactly with the column's SQL Server datatype:
  85.        o SYBVARCHAR is returned as SYBCHAR.
  86.  
  87.        o SYBVARBINARY is returned as SYBBINARY.
  88.  
  89.  
  90.   5                       Version 4.0 -- 5/1/89                dbcoltype
  91.   ______________________________________________________________________
  92.  
  93.        o SYBDATETIMN is returned as SYBDATETIME.
  94.        o SYBMONEYN is returned as SYBMONEY.
  95.  
  96.        o SYBFLTN is returned as SYBFLT8.
  97.        o SYBINTN is returned as SYBINT1, SYBINT2, or SYBINT4,  depending
  98.          on the actual type of the SYBINTN.
  99.  
  100.       If the column number is not in range, dbcoltype() returns -1.
  101.  
  102.   SEE ALSO:
  103.        dbcollen,  dbcolname,  dbdata,  dbdatlen,  dbnumcols,   dbprtype,
  104.        dbvarylen, types
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.